package com.kevin.websocket.client.configuration.websocket;

import lombok.extern.slf4j.Slf4j;
import org.java_websocket.handshake.ServerHandshake;

import java.net.URI;

@Slf4j
public class WebSocketClient extends org.java_websocket.client.WebSocketClient {

    public WebSocketClient(URI serverUri) {
        super(serverUri);
    }

    @Override
    public void onOpen(ServerHandshake serverHandshake) {
        log.debug("connection successful : {}", serverHandshake.getHttpStatus());
    }

    @Override
    public void onMessage(String message) {
        log.debug("message : {}", message);
    }

    @Override
    public void onClose(int i, String s, boolean b) {
        log.debug("disconnected successful");
    }

    @Override
    public void onError(Exception e) {
        log.warn("exception : {}", e.getMessage(), e);
    }

}
